/**
 *
 */
package service.impl;

import common.consts.Consts;
import dao.RecommendRecruitmentDao;
import dao.VRecommendRecruitmentIdDao;
import domain.VRecommendRecruitmentId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import service.RecommendRecruitmentService;
import service.ServiceResponse;

import java.util.List;

/**
 * Created by chen <chen@youjianghr.com> on 2015年7月11日.
 *
 * @author chen <chen@youjianghr.com>
 */

@Service
public class RecommendRecruitmentServiceImpl extends ServiceBase implements RecommendRecruitmentService {


    @Autowired
    private RecommendRecruitmentDao recommendRecruitmentDao;

    @Autowired
    private VRecommendRecruitmentIdDao vRecommendRecruitmentIdDao;


    /* (non-Javadoc)
     * @see service.RecommendRecruitmentService#getAllRecommendRecruitmentWithDesc()
     */
    @Override
    @Transactional
    public ServiceResponse getAllRecommendRecruitmentWithDesc() {
        // TODO Auto-generated method stub

        return null;
    }

    @Override
    @Transactional
    public ServiceResponse getAllRecommendRecruitmentViewWithDesc(int page, int rows) {

        List<VRecommendRecruitmentId> vRecommendRecruitments = vRecommendRecruitmentIdDao.list(page, rows);

        if (vRecommendRecruitments == null || vRecommendRecruitments.size() == 0) {
            return ServiceResponse.fail(Consts.i18nKey.RECOMMEND_EMPTY);
        } else {
            return ServiceResponse.success().with("recommendRecruitment", vRecommendRecruitments);
        }
    }

    public void setRecommendRecruitmentDao(RecommendRecruitmentDao recommendRecruitmentDao) {
        this.recommendRecruitmentDao = recommendRecruitmentDao;
    }

    public void setvRecommendRecruitmentDao(VRecommendRecruitmentIdDao vRecommendRecruitmentIdDao) {
        this.vRecommendRecruitmentIdDao = vRecommendRecruitmentIdDao;
    }

}
